import request from '@/utils/request'

// 查询列表
export function listCompany(query) {
  return request({
    url: '/yanjing/company/list',
    method: 'get',
    params: query
  })
}

// 查询详细
export function getCompany(companyId) {
  return request({
    url: '/yanjing/company/' + companyId,
    method: 'get'
  })
}

// 新增
export function addCompany(data) {
  return request({
    url: '/yanjing/company',
    method: 'post',
    data: data
  })
}

// 修改
export function updateCompany(data) {
  return request({
    url: '/yanjing/company',
    method: 'put',
    data: data
  })
}

// 删除
export function delCompany(companyId) {
  return request({
    url: '/yanjing/company/' + companyId,
    method: 'delete'
  })
}

export function batchAudit(companyIds) {
  return request({
    url: '/yanjing/company/batchAudit/' + companyIds,
    method: 'post'
  })
}

export function batchAuditSuccess(companyIds) {
  return request({
    url: '/yanjing/company/batchAuditTrue/' + companyIds,
    method: 'post'
  })
}

export function batchAuditFalse(companyIds) {
  return request({
    url: '/yanjing/company/batchAuditFalse/' + companyIds,
    method: 'post'
  })
}

export function disableCompany(companyId) {
  return request({
    url: '/yanjing/company/disable/' + companyId,
    method: 'post'
  })
}

export function enableCompany(companyId) {
  return request({
    url: '/yanjing/company/enable/' + companyId,
    method: 'post'
  })
}


/**
 * 下架修改
 * @returns {*}
 * @param companyIds
 */
export function backUpdate(companyIds) {
  return request({
    url: '/yanjing/company/batchBack/'+companyIds,
    method: 'post',
  })
}

export function listSaleUserList(userName) {
  return request({
    url: '/yanjing/company/listSaleUserSelect',
    method: 'post',
    data: userName
  })
}
